<template>
    <el-dialog class="ba-operate-dialog" v-model="baTable.table.extend!.showDetailDialog" width="50%">
        <template #header>
            <div class="title" v-drag="['.ba-operate-dialog', '.el-dialog__header']" v-zoom="'.ba-operate-dialog'">
                {{ '评价详情' }}
            </div>
        </template>
        <el-scrollbar v-loading="baTable.form.loading" class="ba-table-form-scrollbar">
            <div
                class="ba-operate-form"
                :class="'ba-' + baTable.form.operate + '-form'"
                :style="config.layout.shrink ? '' : 'width: calc(100% - ' + baTable.form.labelWidth! / 2 + 'px)'"
            >
                <el-form
                    v-if="!baTable.form.loading"
                    ref="formRef"
                    @submit.prevent=""
                    :model="baTable.form.items"
                    :label-position="config.layout.shrink ? 'top' : 'right'"
                    :label-width="baTable.form.labelWidth + 'px'"
                >
                    <el-form-item :label="$t('shop.order.evaluate.goods_name')">
                        {{ detailData.goods_name }}
                    </el-form-item>
                    <el-form-item :label="$t('shop.order.evaluate.user_name')">
                        {{ detailData.user_name }}
                    </el-form-item>
                    <el-form-item :label="$t('shop.order.evaluate.score')">
                        <el-rate v-model="detailData.score" disabled />
                    </el-form-item>
                    <FormItem
                        :label="$t('shop.order.evaluate.content')"
                        type="textarea"
                        v-model="detailData.content"
                        :input-attr="{
                            rows: 7,
                        }"
                    />
                    <FormItem
                        v-if="detailData.images.length > 0"
                        :label="$t('shop.order.evaluate.images')"
                        type="images"
                        v-model="detailData.images"
                        :input-attr="{
                            limit: detailData.images.length,
                            hideImagePlusOnOverLimit: true,
                            disabled: true,
                        }"
                    />
                </el-form>
            </div>
        </el-scrollbar>
        <template #footer>
            <div :style="'width: calc(100% - ' + baTable.form.labelWidth! / 1.8 + 'px)'"></div>
        </template>
    </el-dialog>
</template>

<script setup lang="ts">
import { inject, onMounted } from 'vue'
import type baTableClass from '/@/utils/baTable'
import FormItem from '/@/components/formItem/index.vue'

const baTable = inject('baTable') as baTableClass

import { useConfig } from '/@/stores/config'

const config = useConfig()

const detailData = baTable.table.extend!.detailData

onMounted(() => {})
</script>

<style lang="scss" scoped></style>
